import { FC, useEffect, useState } from "react";
import { Table } from "antd";
import type { LoadedComponentProps } from "@/utils/hooks/useSequentialLoader";

const ChatLoadTable: FC<LoadedComponentProps> = ({ columns, data, onLoad }) => {
  useEffect(() => {
    onLoad && onLoad();
  }, []);
  return (
    <>
      {data && !!data.length && (
        <div className="chat-load-table">
          <Table
            rowKey="id"
            dataSource={data}
            columns={columns}
            pagination={false}
          ></Table>
        </div>
      )}
    </>
  );
};

export default ChatLoadTable;
